package com.woniuxy.oldmanapi.mapper;

import com.woniuxy.oldmanapi.cvo.DeliveryVo;
import com.woniuxy.oldmanapi.entity.Delivery;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;
import java.util.List;

@Repository
public interface DeliveryMapper extends Mapper<Delivery> {
    List<DeliveryVo> selectDeliVerysByCon(@Param("state") int state, @Param("oldername") String oldername);

    @Update("update delivery set state=2 ,rechargeMoney=0 where id=#{id}")
    void cancelDelivery(int id);

    @Update("update delivery set state=#{state},rechargeMoney=#{rechargePay},cardNum=#{cardnum} where id=#{id}")
    void updatePay(@Param("id") int id,@Param("state") int state,@Param("rechargePay") BigDecimal rechargePay,@Param("cardnum") String cardnum);

    @Select("select * from delivery where id=#{id}")
    Delivery selectByDId(int id);
    void insertOfdelivery(Delivery delivery);

    void updateOfdelivery(Delivery delivery);
}
